package main

import (
	"errors"
	"fmt"
)

func main() {
	TestMapErr()
}

func TestMapErr() {

	var (
		ErrIsNil                 = errors.New("操作成功")
		ErrParamError            = errors.New("请求参数错误")
		ErrInternalError         = errors.New("内部系统错误")
		ErrSessionError          = errors.New("会话已过期")
		ErrUserNotExist          = errors.New("用户不存在")
		ErrPhoneIsBinded         = errors.New("手机已绑定其他帐号")
		ErrUserIsBinded          = errors.New("帐号已绑定其他手机")
		ErrUserDelError          = errors.New("帐号删除失败")
		ErrGoodIdNotExist        = errors.New("靓号不存在")
		ErrOriginIdNotExist      = errors.New("原始帐号不存在")
		ErrGoodIdIsUsed          = errors.New("靓号已被使用")
		ErrPhoneCodecError       = errors.New("手机号加解密失败")
		ErrUserPhoneNotMatch     = errors.New("用户原手机信息错误")
		ErrPasswdError           = errors.New("密码错误")
		ErrPasswdExistError      = errors.New("密码已设置")
		ErrPasswdNotExistError   = errors.New("密码未设置")
		ErrPhoneVerifyCountLimit = errors.New("手机认证已达上限")
		ErrDestroyUser           = errors.New("注销账号失败")
		ErrRepeatAuth            = errors.New("已经认证，无需重复认证")
		ErrRegistException       = errors.New("注册异常")
	)

	var errnoMap map[error]int = map[error]int{
		ErrIsNil:                 0,
		ErrParamError:            499,
		ErrInternalError:         500,
		ErrSessionError:          604,
		ErrUserNotExist:          701,
		ErrPhoneIsBinded:         702,
		ErrUserIsBinded:          703,
		ErrUserDelError:          704,
		ErrGoodIdNotExist:        710,
		ErrOriginIdNotExist:      711,
		ErrGoodIdIsUsed:          712,
		ErrPhoneCodecError:       713,
		ErrUserPhoneNotMatch:     714,
		ErrPasswdError:           200004,
		ErrPasswdExistError:      100004,
		ErrPasswdNotExistError:   100003,
		ErrPhoneVerifyCountLimit: 100005,
		ErrDestroyUser:           100006,
		ErrRepeatAuth:            100007,
		ErrRegistException:       100008,
	}
	err := errors.New("context deadline exceeded")
	_, exist := errnoMap[err]
	fmt.Sprintln(exist)
}
